﻿using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Seagull;
using Seagull.Foundation;

namespace sample1
{
    public class Ping : IEvent
    {
    }

    public class Pong1 : IEventHandler<Ping>
    {
        public Task Handle(EventContext<Ping> context)
        {
            Debug.WriteLine("Pong 1");
            return Task.CompletedTask;
        }
    }

    public class Pong2 : IEventHandler<Ping>
    {
        public Task Handle(EventContext<Ping> context)
        {
            Debug.WriteLine("Pong 2");
            return Task.CompletedTask;
        }
    }

    #region 接口方式
    public interface IPongDelete
    {
        /// <summary>
        /// 删除产品
        /// </summary>
        /// <param name="id"></param>
        void Delete(int id);
    }

    public interface IPongChenged
    {
        /// <summary>
        /// 变更产品
        /// </summary>
        /// <param name="id"></param>
        void Chenged(int id, string name);
    }

    public class Pong3 : IPongDelete, IPongChenged
    {
        public void Chenged(int id, string name)
        {
            IPongDelete pongDelete = new Pong3();
            pongDelete.Delete(id);
        }


        public void Delete(int id)
        {
        }

    }

    public class Pong4 : IPongDelete, IPongChenged
    {
        public void Chenged(int id, string name)
        {
        }

        public void Delete(int id)
        {
        }
    }
    #endregion

}
